<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<style type="text/css"> 

  
 </style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>글목록</title>
<link type="text/css" href="/jquery_ui/css/jquery-ui.css" rel="stylesheet" />	
<script type="text/javascript" src="/jquery_ui/js/jquery.js"></script>
	<script type="text/javascript" src="/jquery_ui/js/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$( ".datepicker" ).datepicker({
	"dateFormat":"yymmdd",
		"minDate": "-1M", "maxDate": "+1Y",
		"changeMonth":true,
		"changeYear":true
});

});

function nogo(){
	var form=document.fo;
	var chch=document.fo.ch;
	var count=0;
	for(var i=0;i<chch.length;i++){
		if(chch[i].checked){
			count++;
		}
	}
		if(1 > count){
			alert("선택하시오");
			
		}else{
			form.submit();
		}
	
}

function allcheck(){ 
	var allchk=document.fo.gg.checked;
	var cho=document.fo.ch;
	var coun=0;
	for(var i=0;i<cho.length;i++){
		coun++;
		cho[i].checked = allchk;
		}
	if(count<1){
		cho.checked = allchk;
			}
	
	} 
	
function okman(){
	
	var a= $("#seok").val();
	
	if(!a){
		alert("올바른 값을 입력하세요");
		document.getElementById("seok").focus();
		return false;
	}
	document.searcha.submit();
}
function okmans2(){
	var b=$("#startDate").val();
	var c=$("#endDate").val();
	if(!b||!c){
		alert("날짜를 선택하세요");
		
	}else {
		document.z.submit();
	}
	
}

</script>
 <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />  
      <script src="http://code.jquery.com/jquery-1.8.3.js"></script>  
      <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>  
      <link rel="stylesheet" href="/resources/demos/style.css"/>  
    

<style type="text/css">
table{
	width :650px;
	border-collapse: collapse;
}
td{
	padding: 5px;
}
</style>
</head>
<body>
<a href="notice.do?method=noticeListController"><h2>글게시판</h2></a>
<input type="button" value="즐겨찾기" onClick="javascript:window.external.AddFavorite('http://www.ziwoo.net','지우넷')">
 
<hr color="red">
   <form action="notice.do" method="post" name="fo">
   <input type="hidden" name="method" value="checkDel">
<table id="content" border="1">
	<tr>
		<td width="10px"><input type="checkbox" name="gg" onclick="allcheck()"></td>
		<td width="65px">글번호</td>
		<td>제목</td>
		<td width="80px">작성자</td>
		<td width="60">작성일</td>
		<td width="60">조회수</td>
	</tr>
	<input type="button" onclick="nogo()" value="삭제"/>
	
	<c:forEach items="${requestScope.list.list }" var="nto">
	
		<tr>
		<td width="10px"><input type="checkbox" name="ch" value="${nto.noticeNo }"></td>
			<td>${nto.noticeNo }</td>
			<td>
				
				<a href="notice.do?method=selectAllInfo&no=${nto.noticeNo }&page=${requestScope.list.pagingTO.currentPage}">
					${nto.noticeTitle }
				</a>  [${nto.commentCount}]
			</td>
			<td>${nto.noticeWriter }</td>
			<td>${nto.noticeWritedate }</td>
			<td>${nto.noticeViewcount }</td>
		</tr>	
	</c:forEach>
	</form>
</table>
<p>
<table>
	<tr>
		<td>		
		<c:choose>
			<c:when test="${requestScope.list.pagingTO.previousPageGroup }">
				<a href="notice.do?method=noticeListController&page=${requestScope.list.pagingTO.startPageOfPageGroup -1 }">
				◀
				</a>
			</c:when>
			<c:otherwise>
				◀
			</c:otherwise>
		</c:choose>
		<c:forEach begin="${requestScope.list.pagingTO.startPageOfPageGroup }"
							   end="${requestScope.list.pagingTO.endPageOfPageGroup }"
							   step="1"
							   var ="i">
			<c:choose>
				<c:when test="${i == requestScope.list.pagingTO.currentPage }">
					${i }
				</c:when>
				<c:otherwise>
					<a href="notice.do?method=noticeListController&page=${i }">${i }</a>
				</c:otherwise>
			</c:choose>			
		</c:forEach>
		<c:choose>
			<c:when test="${requestScope.list.pagingTO.nextPageGroup }">
				<a href="notice.do?method=noticeListController&page=${requestScope.list.pagingTO.endPageOfPageGroup + 1 }">
					▶
				</a>
			</c:when>
			<c:otherwise>
				▶
			</c:otherwise>
		</c:choose>
		
		<td>
	</tr>
</table>
  




<a href="notice.do?method=writeNotice&mid="${sessionScope.mto.memberId}">글쓰기</a>


<form action="notice.do" method="post" id="searcha">
<input type="hidden" name="method" value="searchYo">

작성자조회<input type="radio" name="search" checked="checked" value="wris">:
제목검색<input type="radio" name="search" value="tits">:<br>
<input type="text" name="txt" id="seok" >
<input type="button" value="찾자" onclick="okman()">
</form>
<form action="notice.do?method=dateSearch" method="post" name="z" id="z">
시작날짜 : <input type="text" class="datepicker" name="startDate" id="startDate">~종료날짜 : <input type="text" class="datepicker" name="endDate" id="endDate">
<input type="button" onclick="okmans2()" value="찾기">
</form>
<br>

</body>
</html>















